
# BigQuery

**Jitsu** supports [BigQuery](https://console.cloud.google.com/bigquery) as a destination. For more information about BigQuery [see docs](https://cloud.google.com/bigquery/docs).
BigQuery destination can work in stream and batch modes. In stream mode Jitsu uses [BigQuery Streaming API](https://cloud.google.com/bigquery/streaming-data-into-bigquery).
In batch mode Jitsu writes incoming events in formatted file on the Google Cloud Storage and creates a [loading job](https://cloud.google.com/bigquery/docs/loading-data) to store
data from GCP files into BigQuery.

<Hint>
    Using BigQuery destination in the batch mode might decrease your Google bill. <a href="https://cloud.google.com/bigquery/pricing#data_ingestion_pricing">Read more about BigQuery Pricing</a>.
</Hint>

### Configuration

BigQuery destination config consists of the following schema:

```yaml
destinations:
  my_bigquery:
    type: bigquery
    google:
      gcs_bucket: google_cloud_storage_bucket
      bq_project: big_query_project
      bq_dataset: big_query_dataset
      key_file: path_to_bqkey.json # or json string of key e.g. "{"service_account":...}"
```

### google

| Field \(\*required\) | Type | Description | Default value |
| :--- | :--- | :--- | :--- |
| **gcs\_bucket\*** | string | Google cloud storage bucket. | - |
| **bq\_project\*** | string | BigQuery project. | - |
| **bq\_dataset** | string | BigQuery dataset. | `default` |
| **key\_file\*** | string | JSON string with Google key or file path to a file. | - |

### Google Cloud Storage

For using BigQuery in batch mode you should configure custom Google Service Account with permissions on Google Cloud Storage bucket and BigQuery:

- [Create](/docs/configuration/google-authorization) Google Service Account
- Set IAM Permissions (`BigQuery Data Owner` and `BigQuery Job User`) to created Google Service Account.
- [Create](https://cloud.google.com/storage/docs/creating-buckets) Google Cloud Storage bucket
- Give `Storage Object Admin` permission to your Google Service Account in created bucket.